package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Getter
@Setter
public class Dynamic extends BaseDomain {
    //创建者
    private User user;
    //创建时间
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8")
    private Date createTime;
    //文字内容
    private String content;
    //图片
    private String imgUrls;
    //点赞的用户集
    private List<User> likeUsers = new ArrayList<>();
    //评论集
    private List<Comment> comments = new ArrayList<>();

    public String[] getImgUrlsArr(){
        if (StringUtils.hasLength(imgUrls)){
            return imgUrls.split(";");
        }
        return null;
    }

}